/*
package com.chen.positioning.config;

import com.chen.positioning.user.entity.UserManagement;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

*/
/**
 * 定义拦截器
 *//*

@Component
public class ConfigInterceptor implements HandlerInterceptor {
    private static final Logger logger = LoggerFactory.getLogger(ConfigInterceptor.class);
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        HttpSession session = request.getSession();
        // 从session中获取用户信息
        UserManagement comUser = (UserManagement) session.getAttribute("userManagement");

        // session过期
        if(comUser == null){
            logger.info(">>>session过期, 跳至登录页");
            response.sendRedirect("/userManagement/loginIndex");
//            response.sendRedirect("/login"); // 通过接口跳转登录页面, 注:重定向后下边的代码还会执行 ; /outToLogin是跳至登录页的后台接口
            return false;
        }else{
            return true;
        }
    }
}
*/
